<?php
/**
 * Created by : qicaitong.net
 * User: 内蒙古启讯科技信息有限公司
 * Tel: 15648133366（微信）
 */

namespace app\api\controller;


use think\Controller;
use think\Request;
use app\api\model\AdminModel;

class ApiSystem extends Controller
{
    public $admin_obj = null;

    public function _initialize()
    {
        $this->admin_obj = new AdminModel();
    }

    /**
     * 系统管理员接口
     * @/api/api_system/index
     */
    public function index()
    {
        $request_method = Request::instance()->method();
        switch ($request_method) {
            case 'GET' :
                return $this->admin_obj->get_system_admin();
                break;
            case 'POST' :
                return $this->admin_obj->post_system_admin();
                break;
            case 'PUT' :
                return $this->admin_obj->put_system_admin();
                break;
            case 'DELETE' :
                return $this->admin_obj->delete_system_admin();
                break;
            default :
                return $this->system_err();
                break;
        }
    }

    private function system_err() {
        return json(['msg'=>'非法数据']);
    }
}